typedef enum {
BABL_INSTANCE = BABL_MAGIC,
- BABL_TYPE,
+ BABL_TYPE,
+ BABL_TYPE_INTEGER,
+ BABL_TYPE_FLOAT,
BABL_SAMPLING,
BABL_COMPONENT,
BABL_MODEL,
#define BABL_CLASS_TYPE_IS_VALID(klass_type) \
( ((klass_type)>=BABL_INSTANCE ) && ((klass_type)<=BABL_SKY) ?1:0 )
+const char *babl_class_name (BablClassType klass);
+
/* common header for any item inserted into database */
typedef struct
{
BablConversion **to; /*< NULL terminated list of conversions to class */
int bits; /*< number of bits used to represent the data type
(initially restricted to a multiple of 8) */
+ double min_val;
+ double max_val;
} BablType;
+typedef struct
+{
+ BablType type;
+ int is_signed;
+ long max;
+ long min;
+} BablTypeInteger;
+
+typedef struct
+{
+ BablType type;
+ /* sign
+ * biased_exponent
+ * mantissa */
+} BablTypeFloat;
+
typedef struct
{
BablInstance instance;
Babl *imageB;
Babl *imageC;
+ /* FIXME: assumptions made about memory requirements that
+ * are not good
+ */
fooA = babl_malloc(sizeof (double) * n * 4);
fooB = babl_malloc(sizeof (double) * n * 4);
__FUNCTION__, babl_fish, source, destination, n);
return -1;
}
-
- babl->reference_fish.type_to_double->function.linear(
- source,
- fooA,
- n* BABL(babl->fish.source)->pixel_format.bands
- );
+
+ babl_conversion_process (babl->reference_fish.type_to_double,
+ source, fooA,
+ n * BABL(babl->fish.source)->pixel_format.bands);
/* calculate planar representation of fooA, and fooB */
imageB = babl_image_new_from_linear (fooB, babl_model_id (BABL_RGBA));
/* transform fooA into fooB fooB is rgba double */
- babl->reference_fish.model_to_rgba->function.planar(
- imageA->image.bands,
- imageA->image.data,
- imageA->image.pitch,
- imageB->image.bands,
- imageB->image.data,
- imageB->image.pitch,
- n);
+ babl_conversion_process (babl->reference_fish.model_to_rgba,
+ imageA, imageB,
+ n);
+
babl_free (imageA);
babl_free (imageB);
/* calculate planar representation of fooC */
/* transform fooB into fooC fooC is ???? double */
- imageB = babl_image_new_from_linear (fooB, babl_model_id (BABL_RGBA));
- imageC = babl_image_new_from_linear (fooA, BABL(BABL((babl->fish.destination))->pixel_format.model));
-
- babl->reference_fish.rgba_to_model->function.planar(
- imageB->image.bands,
- imageB->image.data,
- imageB->image.pitch,
- imageC->image.bands,
- imageC->image.data,
- imageC->image.pitch,
- n);
+ imageB = babl_image_new_from_linear (
+ fooB, babl_model_id (BABL_RGBA));
+ imageC = babl_image_new_from_linear (
+ fooA, BABL(BABL((babl->fish.destination))->pixel_format.model));
+ babl_conversion_process (babl->reference_fish.rgba_to_model,
+ imageB, imageC,
+ n);
- babl->reference_fish.double_to_type->function.linear(
- fooA, destination, n * BABL(babl->fish.destination)->pixel_format.bands);
+ /* working directly on linear buffers */
+ babl_conversion_process (babl->reference_fish.double_to_type,
+ fooA, destination,
+ n * BABL(babl->fish.destination)->pixel_format.bands);
babl_free (imageB);
babl_free (imageC);